package pers.vicxu.springbootdemo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.vicxu.springbootdemo.dto.User;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * Create by Vic Xu on 2018/8/18
 */
@RestController
@RequestMapping("/user/")
public class UserController {

    @GetMapping("all")
    public List<User> all(HttpServletRequest request) {
        System.out.println(request.getSession().getId());
        List<User> users = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            User user = new User("name" + i, "pwd" + i);
            users.add(user);
        }
        return users;
    }
}
